home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7512 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.th-darmstadt.de!news
  2. From: enno@inferenzsysteme.informatik.th-darmstadt.de (Enno Sandner)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: for (int i(1); ...)
  5. Date: 22 Feb 1996 20:06:02 +0100
  6. Organization: Fachbereich Informatik, TH Darmstadt
  7. Sender: enno@kitz.inferenzsysteme.informatik.th-darmstadt.de
  8. Message-ID: <ltwx5fuqn8.fsf@kitz.inferenzsysteme.informatik.th-darmstadt.de>
  9. References: <4gg2j6$93g@darkstar.UCSC.EDU>
  10. NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
  11. In-reply-to: ray@cse.ucsc.edu's message of 21 Feb 1996 21:24:54 GMT
  12. X-Newsreader: Gnus v5.1
  13.  
  14. In article <4gg2j6$93g@darkstar.UCSC.EDU> ray@cse.ucsc.edu (Ray Swartz) writes:
  15.  
  16.    I noticed that the syntax
  17.  
  18.    for (int i(1); ...)
  19.  
  20.    works just like
  21.  
  22.    for (int i = 1; ...)
  23.  
  24.  
  25.    however, I've not seen this used anywhere.  
  26.  
  27.    This seems odd to me since initializing by assignment is seen as misleading
  28.    when applied to objects.  
  29.  
  30.    Should 
  31.  
  32.    for (int i(1);...)
  33.  
  34.  
  35.    even be used?
  36.  
  37. That's just a matter of taste, because both solutions are exactly the same.
  38. In general an expression like 'AClass A_obj=another_A_obj;' will perform a
  39. copy-construction of an 'AClass' object and won't result in construction +
  40. subsequent assignment.
  41.  
  42.     Enno
  43.